package com.lotus.bos.sms;

import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.springframework.stereotype.Service;

import com.lotus.bos.utils.SendSmsUtil;
@Service
public class QueueConsumer implements MessageListener {

	public void onMessage(Message message) {
		MapMessage map = (MapMessage)message;
		String phoneNum;
		try {
			phoneNum = map.getString("telephone");
			String code = map.getString("code");
			SendSmsUtil.sendMsg(phoneNum, code);
		} catch (JMSException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
